<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>登录</title>
    <link rel="shortcut icon" href="__STATICADMIN__/img/favicona.ico" />
    <!--<link rel="icon" href="" type="image/gif" />-->
    <link href="__STATICADMIN__/css/bootstrap.min14ed.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/font-awesome.min93e3.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/animate.min.css" rel="stylesheet">
    <link href="__STATICADMIN__/css/style.min.css" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="middle-box text-center loginscreen  animated fadeInDown">
    <div>
        <div>
            <h6 class="logo-name">FD</h6>
        </div>
        <h2>FD商城后台登录</h2>
        <form class="m-t" role="form" id="do_login" method="post" action="{:U('Login/index')}">
            <div class="form-group">
                <input type="text" class="form-control" id="username" placeholder="用户名" name="username">
            </div>
            <div class="form-group">
                <input type="password" class="form-control" id="password" placeholder="密码" name="pswd">
            </div>
            <button type="submit" id="button" class="btn btn-primary block full-width m-b">登 录</button>
            <p class="text-muted text-center">
                <a href="#"><small>忘记密码了？</small></a> | <a href="#">注册一个新账号</a>
            </p>
        </form>
    </div>
</div>
</body>
<script src="__STATICADMIN__/js/jquery.min.js"></script>
<script src="__STATIC__/public/js/jquery.form.js"></script>
<script src="__STATIC__/public/layui/lay/dest/layui.all.js"></script>
<script>
    $(function(){
        $('#do_login').ajaxForm({
            beforeSubmit:checkForm,
            success: complete,
            dataType: 'json'
        });
        function checkForm(){
            if($('#username').val() == ''){
               layer.msg('用户名不能为空',{icon:5,time:1000},function(index){
                   layer.close(index);
                   return false;
               });
                $('#username').focus();
                return false;
            }

            if($('#password').val() == ''){
                layer.msg('密码不能为空',{icon:5,time:1000},function(index){
                    layer.close(index);
                    return false;
                });
                $('$password').focus();
                return false;
            }
            $('#button').removeClass('btn-primary').attr('disabled','disabled').addClass('btn-danger').text('登录中...');
        }

        function complete(date){
            if(date.status > 0){
                layer.msg(date.msg,{icon:5,time:1000},function(index){
                    $('button').removeClass('btn-danger').removeAttr('disabled').addClass('btn-primary').text('登录');
                    layer.close(index);
                    return false;
                });
            }else{
                layer.msg(date.msg,{icon:6,time:1500},function(index){
                    layer.close(index);
                    window.location.href='/admin/';
                })
            }
        }
    })
</script>
</html>
